//
//  RateTableViewCell.m
//  Leo01
//
//  Created by 张旭 on 15/9/29.
//  Copyright (c) 2015年 张旭. All rights reserved.
//

#import "RateTableViewCell.h"

@implementation RateTableViewCell
@synthesize navController;
@synthesize weekLabel;
@synthesize checkLabel;
@synthesize checkImage;

-(RateTableViewCell *)getandSetData:(NSString *)subitem{
    weekLabel.text = subitem;
    return self;
}
-(RateTableViewCell *)getandSetColor:(int)colorItem{
    //weekLabel.text = subitem;
    if (colorItem==1){checkImage.image=[UIImage imageNamed:@"duoxuan_select.png"];};
    if (colorItem==0){checkImage.image=[UIImage imageNamed:@"duoxuan.png"];};
    return self;
}

- (void)awakeFromNib {
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    checkImage.contentMode=UIViewContentModeScaleAspectFit;
}

-(void)setChooseStatus:(Boolean)choose{
    if (choose) {
        checkLabel.text = @"✔︎";
        checkImage.image=[UIImage imageNamed:@"duoxuan_select.png"];
        
    }
    else{
        checkLabel.text = @"";
        UIImage *duoxuan=[UIImage imageNamed:@"duoxuan.png"];
        //duoxuan=[self OriginImage:duoxuan scaleToSize:0.8];
        checkImage.image=[UIImage imageNamed:@"duoxuan.png"];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(UIImage*)  OriginImage:(UIImage *)image   scaleToSize:(CGSize)size
{
    // 创建一个bitmap的context
    // 并把它设置成为当前正在使用的context
    UIGraphicsBeginImageContext(size);
    
    // 绘制改变大小的图片
    [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
    
    // 从当前context中创建一个改变大小后的图片
    UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
    
    // 使当前的context出堆栈
    UIGraphicsEndImageContext();
    
    // 返回新的改变大小后的图片
    return scaledImage;
}

@end
